import java.awt.image.BufferedImageFilter;
import java.io.*;

public class Main {
    public static void main(String[] args) throws IOException {
        // 创建文件
        BufferedInputStream bf = new BufferedInputStream(new FileInputStream("D:\\data.txt"));
        byte[] bytes = bf.readAllBytes(); // 获取文件所以数据
        String str = new String(bytes);  // 把数据转换成字符串
        String[] s1 = str.split("，"); // 切分字符串
        for(int i = 0; i < s1.length;i++) { // 遍历字符串数组，创建文件
            String s = "D:\\text\\" +s1[i]+".txt";
            File file = new File(s);
            file.createNewFile();
        }

        // 插入 10个a
        File file = new File("D:\\text\\");
        File[] files = file.listFiles(); // 获取所有文件
        String val = "aaaaaaaaaa";
        for(int i =0;i < files.length;i++) {
            if(files[i].getName().contains("a")) { // 判断文件名字是否包含a
                BufferedOutputStream bo = new BufferedOutputStream(new FileOutputStream(files[i]));
                bo.write(val.getBytes()); // 写入10个a
                bo.flush();
                bo.close();
            }
        }
        System.out.println("================");
    }
}